package com.webproject.core;

import java.util.List;

import org.apache.struts2.json.JSONUtil;

import com.webproject.entity.Filters;
import com.webproject.entity.Rules;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.util.JSONBuilder;

public class Utils {
	private static Utils utils;
	
	public static Utils getInstance(){
		if(null==utils){
			utils=new Utils();
		}
		return utils;
	}
	public List<?> jsonToArray(String jsonString,Class<?> class1){
		JSONObject jsonObject = JSONObject.fromObject(jsonString);
		return null;
	}
	public static void main(String[] args) {
		String jsonString="{'groupOp':'AND','rules':[{'field':'id','op':'eq','data':'12'},{'field':'mobile','op':'eq','data':'23'}]}";
		JSONObject jsonObject=JSONObject.fromObject(jsonString);
		System.out.println(jsonObject.get("rules").toString());
//		String jsonString="[{'field':'id','op':'eq','data':'12'},{'field':'mobile','op':'eq','data':'23'}]";
//		JSONArray jsonArray=JSONArray.fromObject(jsonString);
//		JSONArray.toList(jsonArray, Rules.class);
	}
}
